var app = getApp();

Page({
    data: {
        navArr: [ {
            con: "待录用"
        }, {
            con: "已录用"
        }, {
            con: "待完成"
        }, {
            con: "已完成"
        } , {
            con: "已结算"
        } ],
        current: 0,
        none: [ {
            img: "/hyb_jianzhi/images/btn_bg.png",
            con: "暂无待录用信息"
        } ],
        none1: [ {
            img: "/hyb_jianzhi/images/btn_bg.png",
            con: "暂无已录用信息"
        } ],
        none2: [ {
            img: "/hyb_jianzhi/images/btn_bg.png",
            con: "暂无待完成信息"
        } ],
        none3: [ {
            img: "/hyb_jianzhi/images/btn_bg.png",
            con: "暂无已完成信息"
        } ],
        none4: [ {
            img: "/hyb_jianzhi/images/btn_bg.png",
            con: "暂无已结算信息"
        } ],
        startArr:3,
        clickEnd:false,
        opdId:'',
        fId:'' ,
        dkName:'',
        dkTime:'',
        page: 0,
        pagesize: 8
    },
    timeJobDetailClick: function(n) {
        this.getform(n.detail.formId);
        var e = n.currentTarget.dataset.id,datelist= n.currentTarget.dataset.datelist,bid= n.currentTarget.dataset.bid;
        if(datelist == '1'){
           wx.navigateTo({
            url: "/hyb_jianzhi/joblist/joblist?b_id=" + bid +"&f_id="+e
          });
        }else{
              wx.navigateTo({
            url: "/hyb_jianzhi/job_detail/job_detail?j_id=" + e
          });
        }
      
    },
    onLoad: function(n) {
        var self = this;
        var e = n.index;
            self.getUserBaoming(e);
        if(n.openid && n.f_id){
            var nopdId = n.openid;
            var nFid = n.f_id;
            self.setData({
            current: e,
            opdId:nopdId,
            fId:nFid
             });
            }else{
               self.setData({
            current: e
             }); 
          }; 
        if(self.data.opdId && self.data.opdId !== null){
            app.util.request({
            url: "entry/wxapp/Daka",
            data: {
                openid: wx.getStorageSync("openid"),
                f_openid:self.data.opdId,
                f_id: self.data.fId
            },
            success: function(n) {
                console.log("接口数据"+JSON.stringify(n));
                if(n.data.data.isbaoming == 0){
                    wx.showToast({
                                title: "你未报名!",
                                image: "/hyb_jianzhi/images/errors.png"
                                })
                    return ;
                }else{
                   self.setData({
                    clickEnd:true,
                    dkName:n.data.data.d_name,
                    dkTime:n.data.data.d_time
                }) 
                }
                
            }
        });
        }
    },
    closemodal: function(t) {
        this.setData({
            clickEnd:false
        });
    },
    getform: function(n) {
       app.util.request({
            url: "entry/wxapp/Formid",
            data: {
                openid: wx.getStorageSync("openid"),
                formid: n
            },
            success: function(n) {}
        });
    },
    navTab: function(n) {
        var e = this;
        e.getform(n.detail.formId);
        var t = n.currentTarget.dataset.index;
        e.setData({
            current: t
        }), e.getUserBaoming(t);
    },
    getUserBaoming: function(n) {
        var e = this;
        app.util.request({
            url: "entry/wxapp/Userbaominglist",
            data: {
                openid: wx.getStorageSync("openid"),
                page: e.data.page,
                pagesize: e.data.pagesize,
                n_id: n
            },
            success: function(n) {
                console.log(n), e.setData({
                    list: n.data.data
                });
            }
        });
    },
    goPingClick: function(n) {
        this.getform(n.detail.formId);
        var e = n.currentTarget.dataset.b_id;
        console.log(1), wx.navigateTo({
            url: "/hyb_jianzhi/go_ping/go_ping?b_id=" + e
        });
    },
    delClick: function(n) {
        var e = this;
        e.getform(n.detail.formId);
        var t = n.currentTarget.dataset.b_id;
        wx.showModal({
            title: "提示",
            content: "取消次数如果过多，将会影响你的评分，后期兼职会受到限制！确定取消报名当前兼职吗?",
            success: function(a) {
            if (a.confirm){
                 app.util.request({
                 url: "entry/wxapp/Baomingdel",
                 data: {
                  b_id: t,
                  openid: wx.getStorageSync("openid")
               },
               success: function(n) {
                 wx.reLaunch({
                  url: "/hyb_jianzhi/index/index"
                 });
                }
             });
            }}})
       
    },
    upReview:function(e){
      var self = this;
      var t = e.currentTarget.dataset.b_id;
      wx.navigateTo({
            url: "/hyb_jianzhi/upReview/upReview?b_id="+t
        });
    },
    applyDetailClick: function(n) {
        wx.navigateTo({
            url: "/hyb_jianzhi/apply_detail/apply_detail"
        });
    },
    homeClick: function(n) {
        this.getform(n.detail.formId), wx.reLaunch({
            url: "/hyb_jianzhi/index/index"
        });
    },
    onShareAppMessage: function() {}
});